package com.example.freeengine.wallpaper.fragment.common.picturelist;

import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import com.example.freeengine.R;
import com.example.freeengine.wallpaper.fragment.PictureInfo;


/**
 * @author Terry Deng
 */
public class PictureFullFragment extends Fragment {

    private static final String TAG = PictureFullFragment.class.getSimpleName();

    public PictureFullFragment() {
        // Required empty public constructor
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_picture_full, container, false);
    }

    @Override
    public void onActivityCreated(@Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        ImageView imageView = getView().findViewById(R.id.iv_wallpaper_picture_full);
        assert getArguments() != null;
        Log.i(TAG, "onCreateView: " + getArguments().getParcelable("pictureInfo"));
        imageView.setImageURI(Uri.parse(((PictureInfo)getArguments().getParcelable("pictureInfo")).getPath()));
    }
}